<template>
  <view :style="themeColor">
    <view class="page">
      <view class="flex flex-wrap align-center justify-between benben-position-layout flex evaluation_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-center evaluation_fd0_0' @tap.stop="handleJumpDiy" data-type="back"
          data-url="1">
          <image class='evaluation_fd0_0_c0' mode="aspectFit" :src='STATIC_URL+"234.png"'></image>
        </view>
        <text class='evaluation_fd0_1'>{{$t('评价')}}</text>
        <view class='flex flex-wrap align-center evaluation_fd0_0'>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
      <benben-goods-evaluate class='evaluation_flex_evaluate_1' :goods-list.sync='dataDetails.orderRecItems'
        v-model='goods_comment'>
      </benben-goods-evaluate>
      <view
        class="flex flex-direction flex-wrap align-center justify-center benben-position-layout flex evaluation_flex_2">
        <button class='evaluation_fd2_0' @tap.stop="handleSubmitFunc()">{{$t('提交')}}</button>

      </view>
      <view :style="{height: '88rpx'}"></view>


    </view>
  </view>
</template>
<script>
  import {
    validate
  } from '@/common/utils/validate.js'

  export default {
    components: {},


    data() {
      return {
        "dataDetails": {
          "aid": "",
          "order_sn": "",
          "order_money": "",
          "payable_money": "",
          "coupon_id": "",
          "coupon_money": "",
          "send_time": "",
          "receive_time": "",
          "pay_time": "",
          "discount_money": "",
          "create_time": "",
          "pay_type": "",
          "status": "",
          "pay_type_str": "",
          "order_info": {
            "receiver_mobile": "",
            "receiver_address": "",
            "receiver_name": "",
            "remark": "",
            "province": "",
            "city": "",
            "district": "",
            "sex": "",
            "label_name": "",
            "express_price": "",
            "pickup_code": "",
            "pickup_img": ""
          },
          "order_goods_list": [],
          "shop_info": {
            "aid": "",
            "store_name": "",
            "store_logo": "",
            "store_logo_id": ""
          },
          "btn_list": {
            "cancel_order": "",
            "go_pay": "",
            "remind_send": "",
            "remind_already": "",
            "apply_invoice": "",
            "view_invoice": "",
            "apply_refund": "",
            "view_logistics": "",
            "confirm_receive": "",
            "evaluate": "",
            "delete_order": "",
            "pay_balance": ""
          },
          "is_multiple_package": "",
          "order_type": "",
          "advance_sn": "",
          "usermerchant_id": "",
          "discount_str": "",
          "surplus_receive_time": "",
          "group_info": {
            "join_timeout": "",
            "activity_status": "",
            "group_members_nums": "",
            "join_number": "",
            "status_txt": ""
          },
          "group_user": [],
          "real_money": "",
          "cancel_surplus_second": "",
          "balance_payment_stime": "",
          "balance_payment_etime": "",
          "receive_surplus_time": "",
          "goods_total": "",
          "pay_status": "",
          "final_order_sn": "",
          "balance_money": "",
          "final_status": "",
          "deposit": ""
        },
        "goods_comment": "",
        "text": "shenqingchengg",
        "id": "1018",
        types: ''
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {
      let {
        id,
        types
      } = options
      if (id !== undefined) this.id = id
      if (types !== undefined) this.types = types
      this.queryDetailsFunc()
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      //订单-订单详情
      async queryDetailsFunc() {
        //请求方法
        //数据验证
        let urlsdata = ''
        if (this.types == 1) { //购买
          urlsdata = global.apiUrls.getAppBuyOrderDetail
        } else {
          urlsdata = global.apiUrls.getAppLeaOrderDetail
        }
        let datadataDetails = await this.$api.get(urlsdata, {
          id: this.id,
          // is_comment: '1'
        });

        if (datadataDetails.data.code != 0) {
          this.$message.info(datadataDetails.data.msg);
          return
        }
        let infodataDetails = datadataDetails.data;
        this.dataDetails = infodataDetails.data

      },
      //发布评论
      async handleSubmitFunc() {
        var flag = true
        var objData = JSON.parse(this.goods_comment)
        objData.forEach(it => {
          it.evalRemark = it.evalRemark.trim();
          if (it.evalRemark == '') {
            flag = false
            return
          }
        })
        if (flag == false) {
          this.$message.info('请输入您的评价')
          flag = true
          return
        }

        let objdata = JSON.parse(this.goods_comment)[0]
        console.log('pppp', objdata.evalPics)
        objdata.evalPics = objdata.evalPics.join(',')
        //请求方法
        //数据验证
        let urlsdata = ''
        if (this.types == 1) { //购买
          urlsdata = global.apiUrls.userEvalBuyOrder
        } else {
          urlsdata = global.apiUrls.userEvalLeaOrder
        }
        let data64218d79d9401 = await this.$api.dbPost(urlsdata, objdata);
        if (!data64218d79d9401) return
        if (data64218d79d9401.data.code != 0) {
          this.$message.info(data64218d79d9401.data.msg);
          return
        }
        uni.showToast({
          title: global.i18n.t('评论成功'),
          mask: true,
          icon: 'none',
          duration: 1500
        });
        uni.$emit('shenqingchengg', this.text)
        setTimeout(() => {
          this.$urouter.navigateBack(1);
        }, 500)
      }
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: #F8F8F8;
    background-size: 100% auto;
  }

  .evaluation_flex_0 {
    background: #fff;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 11;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .evaluation_fd0_1 {
    color: #333333;
    font-size: 36rpx;
    font-weight: 500;
    line-height: 50rpx;
  }

  .evaluation_fd0_0_c0 {
    width: 20rpx;
    height: 36rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    margin: 0rpx 0rpx 0rpx 32rpx;
  }

  .evaluation_fd0_0 {
    width: 100rpx;
    height: 88rpx;
  }

  .evaluation_flex_evaluate_1 {
    --star-color: rgba(230, 230, 230, 1);
    --star-size: 28rpx;
    --active-star-color: rgba(255, 127, 0, 1);
    --checked-activer-color: var(--benbenFontColor5);
    --checked-size: 32rpx;
  }

  .evaluation_flex_2 {
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 11;
    bottom: calc(32rpx + var(--window-bottom));
  }

  .evaluation_fd2_0 {
    background: var(--benbenbgColor7);
    border-radius: 44rpx 44rpx 44rpx 44rpx;
    font-size: 32rpx;
    color: #fff;
    width: 686rpx;
    height: 88rpx;
    line-height: 88rpx;
  }
</style>
